import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:tpbook_flutter/public.dart';
import 'me_header.dart';
import 'setting_scene.dart';
import 'me_cell.dart';

class MeScene extends StatelessWidget {
  Widget buildCells(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          MeCell(
            title: '我的书单',
            iconName: 'img/me_buy.png',
            onPressed: () {},
          ),
          MeCell(
            title: '邀请好友',
            iconName: 'img/me_vip.png',
            onPressed: () {},
          ),
          MeCell(
            title: '下载记录',
            iconName: 'img/me_favorite.png',
            onPressed: () {},
          ),
          MeCell(
            title: '扫描本地',
            iconName: 'img/me_record.png',
            onPressed: () {},
          ),
          MeCell(
            title: '帮助与反馈',
            iconName: 'img/me_comment.png',
            onPressed: () {},
          ),
          MeCell(
            title: '设置',
            iconName: 'img/me_setting.png',
            onPressed: () {
              Navigator.push(context, MaterialPageRoute(builder: (context) {
                return SettingScene();
              }));
            },
          ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: AnnotatedRegion(
        value: SystemUiOverlayStyle.dark,
        child: Container(
          color: Colors.white,
          child: ListView(
            children: <Widget>[
              MeHeader(),
              buildItems(),
              SizedBox(height: 10),
              buildCells(context),
            ],
          ),
        ),
      ),
    );
  }

  Widget buildItems() {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        buildItem('0', '今日阅读'),
        buildItem('0', '读过'),
        buildItem('0', '连续阅读'),
        Container(),
      ],
    );
  }

  Widget buildItem(String title, String subtitle) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        Text(
          title,
          style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
        ),
        SizedBox(height: 5),
        Text(
          subtitle,
          style: TextStyle(fontSize: 12, color: SQColor.gray),
        ),
      ],
    );
  }
}
